#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<algorithm>
using namespace std;

int main()
{
	int n = 0;
	int O, V;
	cin >> n;
	cin >> O;
	cin >> V;
	int ma = O / V;
	int mi = ma;
	while (mi * (V + 1) > O)
	{
		mi--;
	}
	mi += 1;
	int tmp1 = ma, tmp2 = mi;
	n--;
	while (n--)
	{
		cin >> O;
		cin >> V;
		ma = O / V;
		mi = ma;
		while (mi * (V + 1) > O)
		{
			mi--;
		}
		mi += 1;
		tmp1 = min(ma, tmp1);
		tmp2 = max(mi, tmp2);
	}
	cout << tmp2 << ' ' << tmp1 << endl;

	return 0;
}